cmake_minimum_required(VERSION 3.10)

set(PROJECT_NAME trtModelDeploy)
SET(CMAKE_BUILD_TYPE "Release")   #Release Debug
set(EXECFILE trtModelInfer)

message(编译项目:${PROJECT_NAME})
message(-------------------${OpenCV_LIBS})

project(${PROJECT_NAME} VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/build)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
message(项目源目录:${PROJECT_SOURCE_DIR})

set(CUDA_INCLUDE_DIR /usr/local/cuda-11.4/targets/aarch64-linux/include)
set(CUDA_LIBRARY_DIR /usr/local/cuda-11.4/targets/aarch64-linux/lib)
link_directories(${CUDA_LIBRARY_DIR})
include_directories(${CUDA_INCLUDE_DIR})
link_libraries(cuda  cufft cudart  cublas curand  cudnn nvinfer nvonnxparser nvinfer_plugin  nvparsers)

set(TRT_INCLUDE_DIR /usr/include/aarch64-linux-gnu)
set(TRT_LIBRARY_DIR /usr/lib/aarch64-linux-gnu)
link_directories(${TRT_LIBRARY_DIR})
include_directories(${TRT_INCLUDE_DIR})

set(OPENCV_INCLUE_DIR /usr/include/opencv4)
include_directories(${OPENCV_INCLUE_DIR})

include_directories(./ ${PROJECT_SOURCE_DIR}/inc)
file(GLOB cpp_files "${PROJECT_SOURCE_DIR}/*.c*" "${PROJECT_SOURCE_DIR}/*/*.c*" "${PROJECT_SOURCE_DIR}/*/*/*.c*")

find_package(OpenCV REQUIRED)
# 打印 OpenCV 信息（可选）
message(STATUS "OpenCV Version: ${OpenCV_VERSION}")
message(STATUS "OpenCV Include Dir: ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV Libraries: ${OpenCV_LIBS}")

add_executable(${EXECFILE} ${cpp_files})
target_link_libraries(${EXECFILE} ${OpenCV_LIBS} pthread)